<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //   `` 模版字符串
        // let name =`这是一个模版字符串`
        // console.log(name);//这是一个模版字符串

        // 1.模版字符串中可以解析变量 `hell,my name is${name}`
        // 传统是需要+号拼接的 'hell,my name si' + name1
        // let name1 = 'pink'
        // let sayHell = `hell,my name si ${name1}`
        // console.log(sayHell);//hell,my name si pink
        // 2.模版字符串中可以换行
        // 传统需要\n 
        let result = {
            name: 'pink',
            age: 20,
            sex: '女'
        }
        let html =
            `
        <div>
            <span>${result.name}</span>
            <span>${result.age}</span>
            <span>${result.sex}</span>
        </div>      
            `
        console.log(html);

        // 3.模版字符串可以调用函数
        const sayhell = () => '我是箭头函数'
        let qreet = `我是模版字符串,${sayhell()}`
        console.log(qreet);
    </script>
</body>

</html>